load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

# The package is deprecated, NET-1274.
package(default_visibility = [
    "//rs/boundary_node/ic_boundary:__pkg__",
    "//rs/cup_explorer:__pkg__",
    "//rs/http_endpoints/public:__pkg__",
    "//rs/nns/init:__pkg__",
    "//rs/orchestrator:__pkg__",
    "//rs/registry/admin:__pkg__",
    "//rs/registry/nns_data_provider:__pkg__",
    "//rs/replay:__pkg__",
    "//rs/rust_canisters/canister_test:__pkg__",
    "//rs/tests:__subpackages__",
])

rust_library(
    name = "canister_client",
    srcs = glob(["src/**"]),
    crate_name = "ic_canister_client",
    # TODO(NET-1274)
    # deprecation = "Please consider https://crates.io/crates/ic-agent instead.",
    version = "0.9.0",
    deps = [
        # Keep sorted.
        "//packages/ic-secp256k1",
        "//rs/canister_client/read_state_response_parser",
        "//rs/canister_client/sender",
        "//rs/canonical_state",
        "//rs/certification",
        "//rs/crypto/tree_hash",
        "//rs/protobuf",
        "//rs/tree_deserializer",
        "//rs/types/management_canister_types",
        "//rs/types/types",
        "@crate_index//:backoff",
        "@crate_index//:futures-util",
        "@crate_index//:http-body-util",
        "@crate_index//:hyper",
        "@crate_index//:hyper-rustls",
        "@crate_index//:hyper-util",
        "@crate_index//:itertools",
        "@crate_index//:prost",
        "@crate_index//:rustls",
        "@crate_index//:serde",
        "@crate_index//:serde_cbor",
        "@crate_index//:tokio",
        "@crate_index//:tower",
        "@crate_index//:url",
    ],
)

rust_test(
    name = "canister_client_test",
    crate = ":canister_client",
    deps = [
        # Keep sorted.
        "//packages/ic-secp256k1",
        "//rs/canister_client/read_state_response_parser",
        "//rs/canister_client/sender",
        "//rs/canonical_state",
        "//rs/certification",
        "//rs/certification/test-utils",
        "//rs/crypto/temp_crypto",
        "//rs/crypto/test_utils/reproducible_rng",
        "//rs/crypto/test_utils/root_of_trust",
        "//rs/crypto/test_utils/tls",
        "//rs/crypto/tree_hash",
        "//rs/protobuf",
        "//rs/test_utilities/types",
        "//rs/tree_deserializer",
        "//rs/types/management_canister_types",
        "//rs/types/types",
        "//rs/validator",
        "@crate_index//:backoff",
        "@crate_index//:futures-util",
        "@crate_index//:hex",
        "@crate_index//:http-body-util",
        "@crate_index//:hyper",
        "@crate_index//:hyper-rustls",
        "@crate_index//:hyper-util",
        "@crate_index//:itertools",
        "@crate_index//:prost",
        "@crate_index//:rand",
        "@crate_index//:rand_chacha",
        "@crate_index//:rustls",
        "@crate_index//:serde",
        "@crate_index//:serde_cbor",
        "@crate_index//:tokio",
        "@crate_index//:tokio-test",
        "@crate_index//:tower",
        "@crate_index//:url",
    ],
)

rust_test(
    name = "canister_client_tls_test",
    srcs = ["tests/tls.rs"],
    deps = [":canister_client"] + [
        # Keep sorted.
        "//packages/ic-secp256k1",
        "//rs/canister_client/read_state_response_parser",
        "//rs/canister_client/sender",
        "//rs/canonical_state",
        "//rs/certification",
        "//rs/certification/test-utils",
        "//rs/crypto/test_utils/crypto_returning_ok",
        "//rs/crypto/test_utils/reproducible_rng",
        "//rs/crypto/test_utils/root_of_trust",
        "//rs/crypto/test_utils/tls",
        "//rs/crypto/tree_hash",
        "//rs/protobuf",
        "//rs/test_utilities",
        "//rs/test_utilities/types",
        "//rs/tree_deserializer",
        "//rs/types/management_canister_types",
        "//rs/types/types",
        "//rs/validator",
        "@crate_index//:backoff",
        "@crate_index//:futures-util",
        "@crate_index//:hex",
        "@crate_index//:http-body-util",
        "@crate_index//:hyper",
        "@crate_index//:hyper-rustls",
        "@crate_index//:hyper-util",
        "@crate_index//:itertools",
        "@crate_index//:prost",
        "@crate_index//:rand",
        "@crate_index//:rand_chacha",
        "@crate_index//:rustls",
        "@crate_index//:serde",
        "@crate_index//:serde_cbor",
        "@crate_index//:tokio",
        "@crate_index//:tokio-test",
        "@crate_index//:tower",
        "@crate_index//:url",
    ],
)
